﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using StonePonyMVC.StonePony.Classes;

namespace StonePonyMVC.Models
{
    public class IndexModel
    {
        public IEnumerable<StonePonyMVC.StonePony.Classes.ImageDescriptor> ImgDescriptors { get; private set; }
        public IEnumerable<StonePonyMVC.StonePony.Classes.ImageDescriptor> EnquiredItems { get; set; }
        public long? SessionId { get; set; }
        public int EnquiredItemsCount { get; set; }

        public IndexModel(IEnumerable<StonePonyMVC.StonePony.Classes.ImageDescriptor> imgDescriptors)
        {
            this.ImgDescriptors = imgDescriptors;
            SessionId = -1L;
            EnquiredItems = null;
            EnquiredItemsCount = 0;
        }
    }

    public class SubmitEnquiryRequestModel
    {

        [Required]
        public string ItemCode { get; set; }

        public string SessionId { get; set; }

        [Required]
        [Display(Name = "First Name*")]
        public string FirstName { get; set; }

        [Required]
        [Display(Name = "Last Name*")]
        public string LastName { get; set; }

        [Display(Name = "Phone")]
        public string Phone { get; set; }

        [Required]
        [Display(Name = "Email*")]
        public string Email { get; set; }

        [Display(Name = "Subsribe to Stone Pony's email list")]
        public string Accept { get; set; }
    }

    [Serializable]
    public class SubmitEnquiryResponseModel
    {
        public bool Success { get; set; }
        public string SessionId { get; set; }
        public int TotalEnquiries { get; set; }
        public string ErrorMessage { get; set; }
        
        // ImageDescriptor essential fields
        public ImageDescriptor EnquiredItem { get; set; }

        public SubmitEnquiryResponseModel()
        {
            Success = false;
            ErrorMessage = SessionId = String.Empty;
            TotalEnquiries = 0;
            EnquiredItem = null;
        }
    }
    [Serializable]
    public class ReloadImagesResponseModel
    {
        public bool Success { get; set; }
        public int TotalImages { get; set; }
        public string ErrorMessage { get; set; }
        public string CategoryName { get; set; }

        // Images in selected category
        public ImageDescriptor[] ImageCollection { get; set; }

        public ReloadImagesResponseModel()
        {
            Success = false;
            TotalImages = 0;
            ErrorMessage = CategoryName = String.Empty;
            ImageCollection = null;
        }
    }

    [Serializable]
    public class LetterModel
    {
        public long SessionId { get; set; }

        public string SiteUrl { get; set; }

        /// <summary>
        /// Mail settings: data are fetched from WEB.CONFIG
        /// </summary>
        public string AdminMailAddress { get; set; }
        public string EmailSender { get; set; }
        public string MailSubject { get; set; }

        [Display(Name = "First Name")]
        public string FirstName { get; set; }

        [Display(Name = "Last Name")]
        public string LastName { get; set; }

        [Display(Name = "Phone")]
        public string Phone { get; set; }

        [Display(Name = "Email")]
        public string Email { get; set; }

        [Display(Name = "Wants to subscribe to our retail newsletter")]
        public bool WantsToSubscribe { get; set; }

        public IList<ImageDescriptor> Items { get; set; }

        public LetterModel()
        {
            this.Items = new List<ImageDescriptor>();
        }
    }
}